package com.maozzi.website.web.controller.rest;

import com.maozzi.common.model.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 管理员 controller
 *
 * @author maozi
 */
@Slf4j
@RefreshScope
@RestController
@RequestMapping("/rest/index")
public class IndexController {
    @Value("${spring.application.name}")
    private String applicationName;

    @Value("${server.port}")
    private Integer port;

    @Value("${website}")
    private String website;

    /**
     * 测试 Spring cloud config 分布式配置中心
     *
     * @return 返回
     */
    @GetMapping("/")
    public ResultVO<String> getAclUser() {
        String msg = "applicationName=%s, port=%d, website=%s".formatted(applicationName, port, website);

        return ResultVO.success(msg);
    }

}
